<html>
<body>
<#--这是注释  -->
<h1>这是文本</h1>
${"这是插值标签"}
<#--直接给值-->

<#--字符串 -->
<li>${"It's双引号转义  \"quoted\" and this is a backslash: \\"} </li>
<li>${'It 单引号转义 \'s "quoted" and this is a backslash: \\'} </li>
<#------------------------------------------------------------------->
<#--原生字符串 -->
<li>${r"${foo}"} </li>
<li>${r"C:\foo\bar"} </li>
<#------------------------------------------------------------------->
<#--数字 -->
 <li>${08}, ${+8}, ${8.00}和${8}都相等</li>
<#-------------------------------------------------------------------> 
 <#--序列 -->
 </br>
 <#list ["winter", "spring", "summer", "autumn"] as x> 
${x} 
</#list> 
<br>
 <#list list[2..10] as x> 
${x} 
</#list> 
<#------------------------------------------------------------------->
<#------字符串操作----->
<br>
${"Hello ${user}!"} 
${"${user}${user}${user}${user}"}
<br>
<#-------------------内建函数 ------------------------>
${test?html} 
${test?upper_case?html}
${test[1]?cap_first} <#-- left side can by any expression --> 
${"horse"?cap_first} 
<br>
<#----------------默认值------------------->
${mouse!"No mouse."} 
<#assign mouse="Jerry"> 
${mouse!"No mouse."} 
<br>
<#------------------------------------------------------------------->
<#------------检测不存在的值------------------->
<#if mouse??> 
  Mouse found 
<#else> 
  No mouse found 
</#if> 
Creating mouse... 
<#assign mouse = "Jerry"> 
<#if mouse??> 
  Mouse found 
<#else> 
  No mouse found 
</#if> 
<#----------------------括号-------------------------->
                                             <#-- 输出是: --> 
${3 * 2 + 2}                              <#-- 8 --> 
${3 * (2 + 2)}                            <#-- 12 --> 
${3 * ((2 + 2) * (1 / 2))}              <#-- 6 --> 
${"green " + "mouse"?upper_case}      <#-- green MOUSE --> 
${("green " + "mouse")?upper_case}    <#-- GREEN MOUSE --> 
<#if !( color = "red" || color = "green")??> 
  The color is nor red nor green 
</#if> 
<#--------------------marcro宏--------------------------->
<br>
<#macro greet> 
  <font size="+2">Hello Joe!</font> 
</#macro> 
<#----marcro宏使用----->
<@greet>test</@greet>
<br>
<#------------------------------------------------------------------->
<#macro greet2 person> 
  <font size="+2">Hello ${person}!</font> 
</#macro> 
<@greet2 "person"></@greet2>
<br>
<#----------------嵌套内容 ----------------------------->
<#macro border> 
  <table border=4 cellspacing=0 cellpadding=4><tr><td> 
    <#nested> 
  </td></tr></table> 
</#macro> 
<@border>The bordered text</@border>
<br>
<#------------------------------------------------------------------->
<li>-----------------------------------------------</li>
<#macro repeat count> 
  <#list 1..count as x> 
    <#nested x, x/2, x==count> 
  </#list> 
</#macro> 
<@repeat count=4 ; t, tc, last,ab> 
  ${t}. ${tc}.<#if last> Last!</#if> 
</@repeat> 
<#------------------------------------------------------------------->
</body>
</html>